package com.imesne;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by liyd on 17/8/15.
 */
@Controller
public class TestController {

    private List<User> users = new ArrayList<>();

    public TestController() {

        for (int i = 0; i < 100; i++) {
            User user = new User();
            user.setUserId(Long.valueOf(i));
            user.setUsername("username-" + i);
            user.setPassword("123456-" + i);
            user.setEmail(i + "-user@imesne.com");
            user.setMobile("13666666666");
            users.add(user);
        }
    }

    @RequestMapping("index")
    public String index(ModelMap modelMap) {

        modelMap.put("users", users);
        return "index";
    }
}
